import request from '@/config/axios'

export interface ResourceContentVO {
  id: number
  groupId: number
  name: string
  type: number
  remark: string
  url: string
}


export const ResourceContentApi = {
  // 创建资源内容
  createResourceContent: async (data: ResourceContentVO) => {
    return await request.post({ url: '/resource/content/create', data })
  },

  // 更新资源内容
  updateResourceContent: async (data: ResourceContentVO) => {
    return await request.put({ url: '/resource/content/update', data })
  },

  // 获取资源内容
  getResourceContent: async (id: number) => {
    return await request.get<ResourceContentVO>({ url: '/resource/content/get?id=' + id })
  },

  // 获取资源列表，根据分组id
  getResourceContentByGroupId: async (groupId: number) => {
    return await request.get<ResourceContentVO[]>({ url: '/resource/content/get-by-group?groupId=' + groupId })
  },

  // 删除资源内容
  deleteResourceContent: async (id: number) => {
    return await request.delete({ url: '/resource/content/delete?id=' + id })
  },

  // 获取资源列表
  getResourceList: async (type?: number) => {
    return await request.get<ResourceContentVO[]>({ url: '/resource/content/list', params: { type } })
  }

}
